//
//  TopViewModel.m
//  test
//
//  Created by wangyang on 2018/8/9.
//  Copyright © 2018年 wangyang. All rights reserved.
//

#import "TopViewModel.h"
@import ReactiveObjC;

@implementation TopViewModel
- (instancetype)init
{
    self = [super init];
    if (self) {
        self.likeCount = 1;
        
        
        @weakify(self)
        [RACObserve(self.viewModel, avatarURL) subscribeNext:^(NSURL *avatarURL) {
            @strongify(self)
            [self.avatarButton sd_setImageWithURL:avatarURL forState:UIControlStateNormal placeholderImage:[UIImage imageNamed:@"default-avatar"]];
        }];
        
        RAC(self.viewModel, username)  = self.usernameTextField.rac_textSignal;
    }
    return self;
}

- (void)singalLikeCount {
    
}

- (void)likeRequest {
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        self.likeCount = 10;
    });
}
@end
